<template>
	<view class="admin-dispose-record-detail">
		<titleName :name="name"></titleName>
		<view class="title-bgc"></view>
		<view class="content-wrap">
			<view class="item">
				<view class="title">
					企业名称：{{enterpriseName }}
				</view>
				<view class="unit">
					处置单位：{{disposeEnterpriseList.find(i=>i.id==data.disposeenterpriseid)?.enterprisename }}</view>
				<view class="type">处置类型：{{ adviceTypeList?.find((i)=>i.value==data.wastetype)?.text }}</view>
				<view class="quality">处置量：{{data.wastenum}}{{unitList?.find((i)=>i.value==data.wasteunit)?.text}}</view>
				<view class="quality">处置联单编号：{{data.orderno}}</view>
				<view class="quality">处置时间：{{data?.committime}}</view>
				<view class="quality">处置联单图片：<text @click="searchImage(data.disposeimgurl)">点击查看</text> </view>
				<view class="quality">车辆信息：{{data.transtruck || '无'}} </view>
				<view class="quality">驾驶员信息：{{data.transdriver || '无'}}</view>
				<image src="https://splendid.oss-cn-beijing.aliyuncs.com/static/imghazardouswaste/beijing-icon.png"
					mode=""></image>
			</view>
			<view class="btn">
				<button @click="editMsg(data.id)">修改信息</button>
			</view>
		</view>

	</view>
</template>

<script setup>
	import titleName from '../../components/titleName.vue'
	import http from '../../request/index'
	import uploadFile from '../../request/uploadFile.js'
	import {
		onShow,
		onLoad
	} from '@dcloudio/uni-app'
	import {
		reactive,
		ref
	} from 'vue'

	let data = ref({})
	let disposeEnterpriseList = ref([])
	let adviceTypeList = ref([])
	let enterpriseName = ref('')
	let enterpriseList = ref([])
	let unitList = ref([])
	let departmentList = ref([])
	let name = "记录详情"
	onShow(() => {

	})
	onLoad((e) => {
		enterpriseName.value = e.name

		http({
			url: '/wasteDispose/detail',
			data: {
				id: e.id
			}
		}).then((res) => {
			if (res.code == 0) {
				data.value = res.data
			}
		})
	})
	http({
		url: '/enterprise/datalist'
	}).then((res) => {
		if (res.code == 0) {
			enterpriseList.value = res.data.list
		}
	})
	let editMsg = () => {
		uni.redirectTo({
			url: `/contorllerPageOther/adminrecorddetailaddandedit/adminrecorddetailaddandedit?add=0&id=${data.value.id}&name=${enterpriseName.value}`
		})
	}

	http({
		url: "/enterpriseThird/listThirdEnterprises"
	}).then((res) => {


		if (res.code == 0) {
			disposeEnterpriseList.value = res.data
		}
	})
	let searchImage = (url) => {
		if (!url) {
			uni.showToast({
				title: '暂无照片',
				icon: "none"
			})
			return
		}
		let imgUrl = url.split(',')
		uni.previewImage({
			urls: imgUrl,
			current: 0
		})
	}
	http({
		url: '/listitem/getmodule',
		data: {
			module: 'B03'
		}
	}).then((res) => {
		if (res.code == 0) {
			let data = res.data
			adviceTypeList.value = data.map((item) => {
				return {
					text: item.name,
					value: item.id
				}
			})

		}
	})
	http({
		url: '/listitem/getmodule',
		data: {
			module: 'B04'
		}
	}).then((res) => {
		if (res.code == 0) {
			let data = res.data
			unitList.value = data.map((item) => {
				return {
					text: item.name,
					value: item.id
				}
			})

		}
	})
</script>

<style lang="scss" scoped>
	.admin-dispose-record-detail {
		width: 100vw;
		height: 100vh;

		.title-bgc {
			width: 750rpx;
			height: 160rpx;
			background: #0874FA;
		}

		.content-wrap {
			width: 100vw;
			height: calc(100vh - 160rpx);
			background-color: #F0F2F5;
			padding-top: 22rpx;
			display: flex;

			display: flex;
			flex-direction: column;
			align-items: center;

			.btn {
				margin-top: 300rpx;

				button {
					margin: 0 auto;
					width: 672rpx;
					height: 88rpx;
					background: #0874FA;
					border-radius: 44rpx;
					line-height: 88rpx;
					font-weight: 500;
					font-size: 31rpx;
					color: #FFFFFF;

				}
			}

			.item {
				width: 690rpx;
				height: 649rpx;
				background: #FFFFFF;
				border-radius: 14rpx;
				padding-left: 33rpx;
				position: relative;

				image {
					position: absolute;
					top: 84rpx;
					height: 25rpx;
					width: 690rpx;
					left: 0;
				}

				.title {

					height: 93rpx;

					font-weight: 500;
					font-size: 31rpx;
					color: #333333;
					line-height: 93rpx;
				}

				.unit,
				.type,
				.quality {
					margin-top: 26rpx;
					font-weight: 400;
					font-size: 28rpx;
					color: #666666;

					text {
						color: #0874FA
					}
				}
			}
		}
	}
</style>